/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package org.tnmk.worktime.service.model.xmladapter;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
import javax.xml.bind.annotation.XmlAnyElement;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Administrator
 * @param <T>
 */
@XmlRootElement
public class XmlList<T> implements List<T> {
  private final List<T> items;

  public XmlList() {
    items = new ArrayList<>();
  }

  public XmlList(List<T> items) {
    this.items = items;
  }

  @XmlAnyElement(lax = true)
  public List<T> getItems() {
    return items;
  }
  //<editor-fold defaultstate="collapsed" desc="List implements">
  @Override
  public int size() {
    return items.size();
  }

  @Override
  public boolean isEmpty() {
    return items.isEmpty();
  }

  @Override
  public boolean contains(Object o) {
    return items.contains(o);
  }

  @Override
  public Iterator<T> iterator() {
    return items.iterator();
  }

  @Override
  public Object[] toArray() {
    return items.toArray();
  }

  @Override
  public <T> T[] toArray(T[] a) {
    return items.toArray(a);
  }

  @Override
  public boolean add(T e) {
    return items.add(e);
  }

  @Override
  public boolean remove(Object o) {
    return items.remove(o);
  }

  @Override
  public boolean containsAll(Collection<?> c) {
    return items.containsAll(c);
  }

  @Override
  public boolean addAll(Collection<? extends T> c) {
    return items.addAll(c);
  }

  @Override
  public boolean addAll(int index, Collection<? extends T> c) {
    return items.addAll(index, c);
  }

  @Override
  public boolean removeAll(Collection<?> c) {
    return items.removeAll(c);
  }

  @Override
  public boolean retainAll(Collection<?> c) {
    return items.retainAll(c);
  }

  @Override
  public void clear() {
    items.clear();
  }

  @Override
  public T get(int index) {
    return items.get(index);
  }

  @Override
  public T set(int index, T element) {
    return items.set(index, element);
  }

  @Override
  public void add(int index, T element) {
    items.add(index, element);
  }

  @Override
  public T remove(int index) {
    return items.remove(index);
  }

  @Override
  public int indexOf(Object o) {
    return items.indexOf(o);
  }

  @Override
  public int lastIndexOf(Object o) {
    return items.lastIndexOf(o);
  }

  @Override
  public ListIterator<T> listIterator() {
    return items.listIterator();
  }

  @Override
  public ListIterator<T> listIterator(int index) {
    return items.listIterator(index);
  }

  @Override
  public List<T> subList(int fromIndex, int toIndex) {
    return items.subList(fromIndex, toIndex);
  }
 //</editor-fold>
}
